#include<iostream>
#include<string>
using namespace std;

class Solution {
public:
    int strStr(string haystack, string needle) {
        int len1 = haystack.size();
        int len2 = needle.size();
        for (int i = 0; i < len1; i++) {
            int flag = 1;
            for (int j = 0; j < len2; j++) {
                if (haystack[i + j] != needle[j]) {
                    flag = 0;
                    break;
                }
            }
            if (flag) return i;
        }
        return -1;
    }
};